{% extends "base.html" %}

{% block title %}{{ settings.site_title }} - 首页{% endblock %}

{% block content %}
<div class="container">
    <div class="main-layout">
        <div class="main-content">
            <div class="post-list">
                {% for post in posts %}
                <article class="post-card">
                    <div class="post-card-content">
                        <h2 class="post-card-title">
                            <a href="{{ url_for('post_detail', slug=post.slug) }}">{{ post.title }}</a>
                        </h2>
                        <div class="post-card-meta">
                            <time datetime="{{ post.created_at }}">{{ post.created_at.split('T')[0] }}</time>
                        </div>
                    </div>
                </article>
                {% else %}
                <div class="no-posts">
                    <p>还没有发布任何文章。</p>
                </div>
                {% endfor %}
            </div>
        </div>
        
        {% if pages %}
        <aside class="sidebar">
            <div class="sidebar-widget">
                <h3 class="widget-title">页面</h3>
                <ul class="page-list">
                    {% for page in pages %}
                    <li class="page-item">
                        <a href="{{ url_for('page_detail', slug=page.slug) }}" class="page-link">{{ page.title }}</a>
                    </li>
                    {% endfor %}
                </ul>
            </div>
        </aside>
        {% endif %}
    </div>
</div>
{% endblock %}
